package com.cbd.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cbd.service.ComplaintrecordService;

@Controller
public class ComplaintInfoController {
	
	@Resource(name="complaintrecordServiceImpl")
	private ComplaintrecordService complaintrecordService;
	
	@RequestMapping(path="sendComplaintInfo")
	public @ResponseBody List<?> sendComplaintInfo(HttpServletRequest req){
		String type = req.getParameter("type");
		String complaintRecordID=req.getParameter("complaintRecordID");
		List<?> infoResult=complaintrecordService.findComplaintInfo(Integer.parseInt(type), Integer.parseInt(complaintRecordID));
		return infoResult;
	}
	
	@RequestMapping(path="updateComplaintrecord")
	public @ResponseBody int updateComplaintrecord(HttpServletRequest req){
		String ispass = req.getParameter("ispass");
		int compID = Integer.parseInt(req.getParameter("complaintRecordID"));
		int compalint=Integer.parseInt(req.getParameter("complaint"));
		System.out.println(ispass+compID+compalint);
		int result = complaintrecordService.updateComplaintrecord(ispass,compalint, compID);
		return result;
	}
}
